package cn.jinjimi.app.plugin;

import android.content.Context;
import android.content.Intent;

import cn.jinjimi.framework.plugin.Plugin;
import cn.jinjimi.framework.plugin.PluginLauncher;
import cn.jinjimi.framework.router.Router;
import cn.jinjimi.app.bean.RouterConstants;
import cn.jinjimi.app.main.activity.TaskListActivity;

/**
 * Created by Hiro on 15/6/3.
 */
public class NativePluginLauncher implements PluginLauncher {

    @Override
    public void launch(Context context, Plugin plugin) {
        if(plugin instanceof NativePlugin){
            NativePlugin p = (NativePlugin)plugin;

            Intent intent = new Intent();

            //关怀客户
            if("ghkh".equals(p.getCode())){
                Router.create(context, RouterConstants.getNativeRouter(RouterConstants.CrmIndex)).open();
            }

            //每日日程
            if("mrrc".equals(p.getCode())){
                intent.setClass(context, TaskListActivity.class);
            }

            if(intent.getClass()!=null)
                context.startActivity(intent);
        }
    }
}
